import React from 'react';
import styles from './index.less';
import { NoData }   from '../common/noData';
export const AuthorItem =(props) =>{
    let  authors = props.value;
    if(authors!= null && authors.length ===0){
        return <NoData/>
    }else if(authors.length <5){
        return (
            <div>
                <ul>
                { authors.map((item) =>{
                    return (
                    <li key={item.id} className={`${ styles.li } ${ styles.clearfix }`}>
                        <a className={styles.ico}>
                        <img alt="头像" src={item.url}/></a>
                        <a className={styles.concern}>+ 关注</a>
                        <a className={styles.authorName}>{item.name}<p>{item.title}</p></a>
                    </li>
                    )
                })}
                </ul>
            </div>
        )
    }else{
        return (
            <div>
                <ul>
                { authors.map((item) =>{
                    return (
                    <li key={item.id} className={`${ styles.li } ${ styles.clearfix }`}>
                        <a className={styles.ico}>
                        <img alt="头像" src={item.url}/></a>
                        <a className={styles.concern}>+ 关注</a>
                        <a className={styles.authorName}>{item.name}<p>{item.title}</p></a>
                    </li>
                    )
                })}
                </ul>
                <a href="#" className={styles.AuthorAll}> 查看全部 ></a>
            </div>
        )
    }
}

  